package models

import (
	_ "github.com/go-sql-driver/mysql"
	"ltbz/cultural_tourism_api/models/system"
	"ltbz/cultural_tourism_api/utils"

	"github.com/beego/beego/v2/client/orm"
)

func init() {
	_ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL)
	orm.SetMaxIdleConns("default", 50)
	orm.SetMaxOpenConns("default", 100)

	orm.RegisterModel(
		new(system.SysSession),
		new(system.SysUser),
		new(system.SysDept),
		new(system.SysMenu),
		new(system.SysRole),
		new(system.SysRoleMenu),
		new(system.SysConfig),
		new(system.SysCompany),
		new(system.SysUserDataAuth),
		new(system.SysXcxBanner),

		//景区
		new(ScenicSpot),
		//操作员
		new(Operator),
		//预约管理
		new(ReserveManage),
	)
	// 记录ORM查询日志
	orm.Debug = true
	orm.DebugLog = orm.NewLog(utils.Binlog)
}
